﻿using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Text;

namespace Socket_Push_SDK
{
    /// <summary>
    /// 服务端校验key的正确性，判断是否允许连接
    /// </summary>
    /// <param name="key">连接url中的key</param>
    /// <returns></returns>
    public delegate bool LinkCheck(string key, HubCallerContext Context);
    /// <summary>
    /// 服务端连接启动时回调
    /// </summary>
    /// <param name="key">连接url中的key</param>
    public delegate void LinkOnConnected(string key, HubCallerContext Context,IClientProxy Client);
    /// <summary>
    /// 服务端连接关闭时回调
    /// </summary>
    /// <param name="key">连接url中的key</param>
    public delegate void LinkOnDisconnected(string key, HubCallerContext Context);
    /// <summary>
    /// 服务端接收信息委托
    /// </summary>
    /// <param name="key">连接url中的key</param>
    /// <param name="action">事件</param>
    /// <param name="data">值</param>
    public delegate void ReciveFunc(string key,string action,object data);
    public interface ILinkAction
    {
        /// <summary>
        /// key校验委托,必须有
        /// </summary>
        /// <returns></returns>
        LinkCheck GetLinkCheck();
        /// <summary>
        /// 连接启动成功时委托，可null
        /// </summary>
        /// <returns></returns>
        LinkOnConnected GetLinkOnConnected();
        /// <summary>
        /// 连接断开时委托，可null
        /// </summary>
        /// <returns></returns>
        LinkOnDisconnected GetLinkOnDisconnected();
        /// <summary>
        /// 接收,可null
        /// </summary>
        /// <returns></returns>
        ReciveFunc GetReciveFunc();
    }
}
